<html>
<head><meta charset="utf-8"><title>rustfmt-on-rust-lang/rust · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustfmt-on-rust-lang.2Frust.html">rustfmt-on-rust-lang/rust</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="134626565"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustfmt-on-rust-lang/rust/near/134626565" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustfmt-on-rust-lang.2Frust.html#134626565">(Sep 25 2018 at 20:39)</a>:</h4>
<p>Have there ever been any discussions about formatting all of the compiler with rustfmt so it is all standardized and the same? Or are there reasons why that cannot be done?</p>



<a name="134626572"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustfmt-on-rust-lang/rust/near/134626572" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustfmt-on-rust-lang.2Frust.html#134626572">(Sep 25 2018 at 20:39)</a>:</h4>
<p>Just something I was curious about.</p>



<a name="134626947"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustfmt-on-rust-lang/rust/near/134626947" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustfmt-on-rust-lang.2Frust.html#134626947">(Sep 25 2018 at 20:45)</a>:</h4>
<p>I thought that it's been happening piecemeal.</p>



<a name="134626972"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustfmt-on-rust-lang/rust/near/134626972" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustfmt-on-rust-lang.2Frust.html#134626972">(Sep 25 2018 at 20:45)</a>:</h4>
<p>The big "reason" I can see is that it will likely break every outstanding PR ;-)</p>



<a name="134627030"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustfmt-on-rust-lang/rust/near/134627030" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustfmt-on-rust-lang.2Frust.html#134627030">(Sep 25 2018 at 20:46)</a>:</h4>
<p>Yeah, I was thinking that it could be done module-by-module, a PR that formats it all and then adds a check to tidy so that it can't regress.</p>



<a name="134627057"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustfmt-on-rust-lang/rust/near/134627057" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustfmt-on-rust-lang.2Frust.html#134627057">(Sep 25 2018 at 20:47)</a>:</h4>
<p>If it has been happening piecemeal then am I right in thinking that it isn't being checked by tidy to make sure code is kept formatted by rustfmt?</p>



<a name="134627086"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustfmt-on-rust-lang/rust/near/134627086" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustfmt-on-rust-lang.2Frust.html#134627086">(Sep 25 2018 at 20:47)</a>:</h4>
<p>I have not seen any such checks (but I'm a lightweight bystander)</p>



<a name="134627148"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustfmt-on-rust-lang/rust/near/134627148" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustfmt-on-rust-lang.2Frust.html#134627148">(Sep 25 2018 at 20:48)</a>:</h4>
<p>For example - <a href="https://github.com/rust-lang/rust/commit/d0c1e5a99e3a9b0d57e8f1deea3c76bd1fb7c0e9" target="_blank" title="https://github.com/rust-lang/rust/commit/d0c1e5a99e3a9b0d57e8f1deea3c76bd1fb7c0e9">https://github.com/rust-lang/rust/commit/d0c1e5a99e3a9b0d57e8f1deea3c76bd1fb7c0e9</a></p>



<a name="134689952"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustfmt-on-rust-lang/rust/near/134689952" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustfmt-on-rust-lang.2Frust.html#134689952">(Sep 26 2018 at 17:18)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> I would really like to see this happen. I want to be able to enable rustfmt-on-save so badly.</p>



<a name="134690668"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustfmt-on-rust-lang/rust/near/134690668" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tom Tromey <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustfmt-on-rust-lang.2Frust.html#134690668">(Sep 26 2018 at 17:32)</a>:</h4>
<p>What would it take?  A flag day could be handled by writing a script people could use to <code>git filter-branch</code> on their pending patches.  Or, maybe it could be done directory-by-directory somehow?</p>



<a name="134693840"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustfmt-on-rust-lang/rust/near/134693840" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryruins <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustfmt-on-rust-lang.2Frust.html#134693840">(Sep 26 2018 at 18:27)</a>:</h4>
<p>maybe it could be done gradually</p>
<ul>
<li>apply #![cfg_attr(rustfmt, rustfmt_skip)] to every module in a swoop, to the point where running rustfmt effectively changes nothing when ran</li>
<li>then one module at a time, prioritizing modules with least chance of breaking PRs or included in/ following large PRs that change a lot anyway, remove the flag. apply rustfmt_skip on individual functions where it matters</li>
<li>now rustfmt runs on the module by default from now on</li>
<li>grep for the module wide attribute to see whats left</li>
</ul>



<a name="134694017"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustfmt-on-rust-lang/rust/near/134694017" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustfmt-on-rust-lang.2Frust.html#134694017">(Sep 26 2018 at 18:30)</a>:</h4>
<p>there's this issue: <a href="https://github.com/rust-lang/rust/issues/49567" target="_blank" title="https://github.com/rust-lang/rust/issues/49567">https://github.com/rust-lang/rust/issues/49567</a></p>



<a name="134694029"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustfmt-on-rust-lang/rust/near/134694029" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustfmt-on-rust-lang.2Frust.html#134694029">(Sep 26 2018 at 18:31)</a>:</h4>
<p>it does mess git blame up entirely, which can be annoying</p>



<a name="134694048"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustfmt-on-rust-lang/rust/near/134694048" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustfmt-on-rust-lang.2Frust.html#134694048">(Sep 26 2018 at 18:31)</a>:</h4>
<p>it's not checked in <code>tidy</code> at the moment, but it would need to be</p>



<a name="134694280"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustfmt-on-rust-lang/rust/near/134694280" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryruins <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustfmt-on-rust-lang.2Frust.html#134694280">(Sep 26 2018 at 18:35)</a>:</h4>
<ul>
<li>oh, and any new module created will have rustfmt ran on it by default</li>
</ul>



<a name="134694828"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustfmt-on-rust-lang/rust/near/134694828" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustfmt-on-rust-lang.2Frust.html#134694828">(Sep 26 2018 at 18:44)</a>:</h4>
<p>I think once the Edition is released we should just do a flag day and be done with it</p>



<a name="134694839"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustfmt-on-rust-lang/rust/near/134694839" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryruins <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustfmt-on-rust-lang.2Frust.html#134694839">(Sep 26 2018 at 18:44)</a>:</h4>
<p>for tidy, running rustfmt as a user could be something like --bless, then for travis, if tidy runs rutstfm and theres a diff, tidy fails (as if it wasnt mercilous enough)</p>



<a name="134694850"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustfmt-on-rust-lang/rust/near/134694850" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustfmt-on-rust-lang.2Frust.html#134694850">(Sep 26 2018 at 18:44)</a>:</h4>
<p>I think that just running rustfmt on a module in a PR and adding a tidy check for new code. After that everyone will just get used to running that on everything for tidy to pass.</p>



<a name="134695056"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustfmt-on-rust-lang/rust/near/134695056" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryruins <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustfmt-on-rust-lang.2Frust.html#134695056">(Sep 26 2018 at 18:48)</a>:</h4>
<p>flag day would pull the bandaid</p>



<a name="134776663"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustfmt-on-rust-lang/rust/near/134776663" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustfmt-on-rust-lang.2Frust.html#134776663">(Sep 27 2018 at 22:07)</a>:</h4>
<p>Is there any issue with the CI running rustfmt itself? Is it simply that we don't fully trust rustfmt yet?</p>



<a name="134776929"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustfmt-on-rust-lang/rust/near/134776929" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustfmt-on-rust-lang.2Frust.html#134776929">(Sep 27 2018 at 22:13)</a>:</h4>
<p>I don't think it is desirable for the CI to actually reformat code, but I think there's some consensus that the CI would run rustfmt in a mode where it will check that a code is formatted. Much in the same way tidy won't wrap lines for you, just tell you that the lines are too long.</p>



<a name="134777625"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustfmt-on-rust-lang/rust/near/134777625" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustfmt-on-rust-lang.2Frust.html#134777625">(Sep 27 2018 at 22:27)</a>:</h4>
<p>And why isn't it desirable?</p>



<a name="134781413"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/rustfmt-on-rust-lang/rust/near/134781413" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/rustfmt-on-rust-lang.2Frust.html#134781413">(Sep 27 2018 at 23:50)</a>:</h4>
<p>Many people (myself included) are pretty wary of automated tools creating git commits containing actual substance.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>